https://leetcode.cn/problems/container-with-most-water/description/


class Solution {
public:
    int maxArea(vector<int>& height) {
        int left=0,right=height.size()-1,ret=0;
        while(left<right)
        {
            int v=min(height[left],height[right])*(right-left);
            
            //更新最大值
            ret=max(v,ret); 

            //移动指针
            if(height[left]<height[right])  left++;
            else right--;
        }
        return ret;
    }
};




盛最多水的容器
class Solution {
public:
    int maxArea(vector<int>& height) {
        vector<int> v;
        int left=0,right=height.size()-1;
        while(left<right)
        {
            int n=height[left]<height[right]?   //找左边 右边小的
            height[left]:height[right];

            v.push_back(n*(right-left));

            if(n==height[left])
            {
                ++left;
            }
            else
            {
                --right;
            }
        }
        int max=0;
        for(auto e:v)
        {
            if(e>max)
                max=e;
        }
        return max;
    }
};

